<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <iframe src="bComData.html" onload="load()" id="iframe"></iframe>
    <script type="text/javascript">
        let first = true;//第一次加载
        function load() {
            if (first) {
                //把bComData.html窗体进行释放，为了安全性考虑
                let iframe = document.querySelector("#iframe");
                iframe.src = 'http://localhost:4000/b.html';
                first = false;
            } else {
                console.log(iframe.contentWindow.name);//yuhua
            }
        }
    </script>
    
</body>

</html>